package ElectricCraft.misc;

/**
 * Rectangle class.
 */
public final class Rectangle {
    public int x, y;
    public int width, height;

    public Rectangle() {
        this(0, 0, 0, 0);
    }

    public Rectangle(int x, int y, int width, int height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }

    public void setBounds(int x, int y, int width, int height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }

    public boolean contains(int x, int y) {
        if (x < this.x || x >= this.x + this.width) {
            return false;
        }
        if (y < this.y || y >= this.y + this.height) {
            return false;
        }
        return true;
    }
}
